/* // 示例一：

// 引入事件模块
let events = require('events')
// 创建eventsEmitter对象
let EventEmitter = new events.EventEmitter()

let connectHandler  = function () {
    console.log('连接数据成功')
    EventEmitter.emit('data_received')
}
// 监听事件
EventEmitter.on('data_received',function() {
    console.log('接收数据成功！！！')
})
EventEmitter.on('connection',connectHandler)
EventEmitter.emit('connection')
 */



// 示例二：
let events = require('events')
 let eventEmitter = new events.EventEmitter()
let util = require('./util')
util.readFiles('test.txt').then(res => {
    eventEmitter.emit('helloSuccess',res)
}).catch(err => {

})


 eventEmitter.on('helloSuccess',function(data) {
     console.log('获取到数据是：',data)
 })


